package com.wdb007.venus.svc.facade;

import java.util.List;
import java.util.Map;

import com.wdb007.venus.svc.facade.book.model.BorrowingBookDTO;
import com.wdb007.venus.svc.facade.charge.model.WxUserRelationDTO;
import com.wdb007.venus.svc.facade.exception.BizException;
import com.wdb007.venus.svc.facade.model.VenusSvcResp;
import com.wdb007.venus.svc.facade.user.model.DeviceUpgradeFlagDTO;
import com.wdb007.venus.svc.facade.user.model.ImgVerifacationDTO;
import com.wdb007.venus.svc.facade.user.model.RankListPageQueryDTO;
import com.wdb007.venus.svc.facade.user.model.RankListPageResultDTO;
import com.wdb007.venus.svc.facade.user.model.ReportAbnormalDTO;
import com.wdb007.venus.svc.facade.user.model.SmsVerifactionDTO;
import com.wdb007.venus.svc.facade.user.model.UserAccessLogDTO;
import com.wdb007.venus.svc.facade.user.model.UserActiveDTO;
import com.wdb007.venus.svc.facade.user.model.UserDespositCashStatusDTO;
import com.wdb007.venus.svc.facade.user.model.UserEntiretyDTO;
import com.wdb007.venus.svc.facade.user.model.UserFamilyMemberDTO;
import com.wdb007.venus.svc.facade.user.model.UserInfoAndOpenIdDTO;
import com.wdb007.venus.svc.facade.user.model.UserInfoDTO;
import com.wdb007.venus.svc.facade.user.model.UserInviteInfoDTO;
import com.wdb007.venus.svc.facade.user.model.UserLastestInfoDTO;
import com.wdb007.venus.svc.facade.user.model.UserQueryDTO;
import com.wdb007.venus.svc.facade.user.model.UserRankDTO;
import com.wdb007.venus.svc.facade.user.model.WeekRankInfoDTO;
import com.wdb007.venus.svc.facade.user.model.WishListPageQueryDTO;
import com.wdb007.venus.svc.facade.user.model.WishListPageResultDTO;
import com.wdb007.venus.svc.facade.user.model.WishListResultDTO;

public interface UserService {
	/**
	 * 得到图形验证码对象
	 * @return
	 */
	ImgVerifacationDTO getValidateImg() throws BizException;
	/**
	 * 需要先判断图形验证码是否正确,如果正确,则给用户发送短信验证码;否则,则给用户返回错误信息.<br/>
	 * 目前不需要判断图形验证码，直接校验手机号是否合法，然后发送短信即可.
	 * @param smsVerifaction
	 * @return 返回发送验证码的状态  0-正常； 1-手机号码校验非法; 2-验证码发送失败
	 */
	int getRegisterCode(SmsVerifactionDTO smsVerifaction, String version) throws BizException;
	/**
	 * 生成短信验证码
	 * @return
	 */
	String generateRegisterCode() throws BizException;
	/**
	 * 给用户发送短信验证码
	 * @param smsVerifaction
	 */
	void sendRegisterCode(SmsVerifactionDTO smsVerifaction) throws BizException;
	/**
	 * 注册/登录之后 返回用户信息
	 * @param smsVerifaction
	 * @return
	 */
	VenusSvcResp<UserEntiretyDTO> login(SmsVerifactionDTO smsVerifaction, UserAccessLogDTO accessLog, String wxUserRelationId) throws BizException;
	
	/**
	 * 注册新用户
	 * @param mobile
	 * @param registrationId
	 * @param visitorIdStr
	 * @param accessLog
	 * @param unionid
	 * @param deposit_amount
	 * @param init_credit_value
	 * @param register_gift
	 * @return
	 * @throws BizException
	 */
	VenusSvcResp<UserEntiretyDTO> registerNewUser(String mobile, String registrationId,
			String visitorIdStr, UserAccessLogDTO accessLog, WxUserRelationDTO record, 
			String deposit_amount, String init_credit_value,
			String register_gift) throws BizException;
	/**
	 * 查询用户最新数据
	 * @param userQuery
	 * @return
	 */
	VenusSvcResp<UserLastestInfoDTO> getUserInfo(UserQueryDTO userQuery) throws BizException;
	
	/**
	 * 根据用户id查询用户数据
	 * @param userId
	 * @return
	 * @throws BizException 
	 */
	UserInfoDTO get(Long userId) throws BizException;
	
	int update(UserInfoDTO infoDTO) throws BizException;
	/**
	 * 保存用户举报异常书格的信息
	 * @param reportAbnormalDTO
	 */
	void reportAbnormal(ReportAbnormalDTO reportAbnormalDTO) throws BizException;
	/**
	 * 获取用户在借图书接口
	 * @param userid
	 * @return
	 */
	BorrowingBookDTO getBorrowingList(Long userid) throws BizException;
	/**
	 * 用户是否被锁定
	 * @param userid
	 * @return 1-被锁定 0-正常状态
	 * @throws BizException 
	 */
	boolean isLocked(Long userid) throws BizException;
	/**
	 * 得到用户目前在借图书数量
	 * @param userid
	 * @return
	 */
	int getBorrowingCount(Long userid) throws BizException;
	
	boolean isInCurrentGrid(Long userid, String gridCode) throws BizException;
	/**
	 * 意见反馈接口
	 * @param reportAbnormalDTO
	 */
	void feedback(ReportAbnormalDTO reportAbnormalDTO) throws BizException;
	
	/**
	 * 注销接口
	 * @param accessLog
	 */
	void logout(UserAccessLogDTO accessLog) throws BizException;
	
	VenusSvcResp<String> equipActive(UserActiveDTO activeDTO) throws BizException;
	
	String equipActiveStatus(UserActiveDTO activeStatus) throws BizException;
	
	WishListPageResultDTO queryWishList(WishListPageQueryDTO pageQueryDTO) throws BizException;
	
	List<WishListResultDTO> queryWishListV2(WishListPageQueryDTO pageQueryDTO) throws BizException;
	
	void removeWishBook(Long id, Long userId, String isbn) throws BizException;
	
	void saveWishBook(Long userId, String isbn) throws BizException;
	
	int getIsbnWishFlag(String isbn, Long userId) throws BizException;
	/**
	 * 
	 * @Method:queryRankList
	 * @Description:排行接口
	 * @Time 2017年10月25日 下午2:38:22
	 * @author: Tom
	 * @param pageQueryDTO
	 * @param userId 
	 * @return
	 * @throws BizException
	 */
	RankListPageResultDTO queryRankList(RankListPageQueryDTO pageQueryDTO, Long userId) throws BizException;
	/**
	 * 查询该用户本周内在全国范围内的排名。
	 * @param userId
	 * @return
	 * @throws BizException
	 */
	String getPersonRank(Long userId) throws BizException;
	/**
	 * 
	 * @Method:queryUserRank
	 * @Description:用户当前排行接口
	 * @Time 2017年10月26日 下午1:55:00
	 * @author: Tom
	 * @param pageQueryDTO 
	 * @param userId
	 * @return
	 * @throws BizException
	 */
	UserRankDTO queryUserRank(RankListPageQueryDTO pageQueryDTO, Long userId) throws BizException;
	
	UserDespositCashStatusDTO queryUserDepositAmount(Long userid) throws BizException;
	
	String  uploadUserHead(byte[] imgData) throws BizException;
	
	void updateUserInfo(UserInfoDTO infoDTO) throws BizException;
	
	DeviceUpgradeFlagDTO getUpgrade(Integer deviceType, String version) throws BizException;
	
	List<UserFamilyMemberDTO> getFamilyMembers(Long userId) throws BizException;
	
	void updateUserFamilyMember(UserFamilyMemberDTO dto) throws BizException;
	
	void addUserFamilyMember(UserFamilyMemberDTO dto) throws BizException;
	
	String aesDecrypt(String bookcaseId) throws BizException ;
	
	String getUserVIPEndDate(String mobile_no) throws BizException;
	
	VenusSvcResp<UserLastestInfoDTO> getUserInfoByWx(String openid, String appid) throws BizException;
	
	/**
	 * 根据手机号查询userid信息
	 */
	String getUserInfo(String mobileNo) throws BizException;
	
	/**
	 * 根据userid和channel查询token
	 */
	String getTokenByChannelAndUserId(Long userId, Byte channel) throws BizException;
	
	VenusSvcResp<UserEntiretyDTO> loginWithoutVerifaction(String registrationId,String visitorIdStr, 
			String mobile,UserAccessLogDTO accessLog, String unionid) throws BizException;
	
	UserInviteInfoDTO getInviteInfo(Long userId) throws BizException;
	
	List<WeekRankInfoDTO> queryWeekRankList() throws BizException;
	
	WeekRankInfoDTO queryPersonInWeekRank(Long userId) throws BizException;
	
	Map<String, Object> readTitleMappingName(Integer readCount) ;
	
	Map<String, Object> selectCurrentTitleByRead(Integer maxRead) ;


	List<UserInfoAndOpenIdDTO> getUserinfoByUnionids(String unionids);
	
	/**
	 * 更新record和userid之间的关系，唯一绑定
	 * @param record
	 * @param userid
	 */
	void setUserinfoUnionidNull(WxUserRelationDTO record, Long userid);

	String getMobile(String usertoken);
	/**
	 * 查询wx_user_relaotion信息
	 * @param usertoken
	 * @param userId
	 * @param appId
	 * @return
	 */
	Map<String, Object> getWxUserinfoByTokenV2(String usertoken, Long userId, String appId);

	boolean isNewUser(String mobileNo);
	
	String zhimaAdmittance(Long userid, String certNo, String realName) throws BizException;
	
}
